import Vue from 'vue'
import Vuex from 'vuex'
import Home from '../views/Home'
import Exam from '../views/Exam'
import User from '../views/User'
import Class from '../views/Class'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    routes: [
      {
        path: "/home",
        component: Home,
        children: [
          {
            path: "/home/exam",
            component: Exam,
            // 自定义字段
            meta: {
              title: "试题管理",
              auth: ["管理员", "出题者", "浏览者"]
            }
          },
          {
            path: "/home/user",
            component: User,
            meta: {
              title: "用户管理",
              auth: ["管理员",  "出题者"]
            }
          },
          {
            path: "/home/class",
            component: Class,
            meta: {
              title: "班级管理",
              auth: ["管理员"]
            }
          }
        ]
      }
    ]
  },
  mutations: {
    CHNAGE_CHILD(state, { list }) {
      state.routes[0].children = list
    }
  },
  actions: {
  },
  modules: {
  }
})
